<template>
  <a-modal
    :title="title"
    :width="1000"
    :visible="visible"
    :confirmLoading="confirmLoading"
    :okButtonProps="{ props: {disabled: disableSubmit} }"
    @ok="handleOk"
    @cancel="handleCancel"
    cancelText="关闭">
    <a-spin :spinning="confirmLoading">

      <a-tab-pane tab="自动脱敏详情表" key="1" :forceRender="true">
        <a-table
          ref="table"
          size="middle"
          bordered
          rowKey="id"
          :loading="loading"
          :columns="columns"
          :dataSource="dataSource"
          :pagination="ipagination"
          @change="handleTableChange">
           <span slot="fdFieldid_dictText" slot-scope="text">
          <j-ellipsis :value="text" :length="6" />
        </span>
        <!--  <span slot="action" slot-scope="text, record">
          <a @click="handleEdit(record)">编辑</a>
          </span>-->
        </a-table>
      </a-tab-pane>
    </a-spin>

  </a-modal>
</template>

<script>
  import { httpAction, getAction,postAction } from '@/api/manage'
  import { FormTypes, VALIDATE_NO_PASSED, getRefPromise, validateFormAndTables } from '@/utils/JEditableTableUtil'
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import JEllipsis from "@/components/jeecg/JEllipsis";

  export default {
    name: "OpersscFiddetailModal",
    components: {
      JEllipsis,},
    mixins:[JeecgListMixin],

    data () {
      return {

        visible: false,
        model: {},
        fdTableId:{},
        fdSscid:{},
        pageNo:{},
        pageSize:{},
        disableSubmit: true,
        //编辑信息

        // 表头
        columns: [
          {
            title: '#',
            dataIndex: '',
            key: 'rowIndex',
            width: 60,
            align: "center",
            customRender: function(t, r, index) {
              return parseInt(index) + 1;
            }
          },
		   /*{
            title: '订阅id',
            align:"center",
            dataIndex: 'fdSscid'
           },
		   {
            title: '表id',
            align:"center",
            dataIndex: 'fdTableId'
           },
		   {
            title: '字段id',
            align:"center",
            dataIndex: 'fdFieldid'
           },*/
          {
            title: '字段名称',
            align:"center",
            dataIndex: 'fdFieldname'
          },
          {
            title: '描述',
            align:"center",
            dataIndex: 'fdFieldid_dictText',
            scopedSlots: {customRender: 'fdFieldid_dictText'},
          },
		   {
            title: '规则名称',
            align:"center",
            dataIndex: 'fdRulename'
           },

		   {
            title: '规则级别',
            align:"center",
            dataIndex: 'fdRulelevel_dictText'
           },
		   {
            title: '是否脱敏',
            align:"center",
            dataIndex: 'fdDes_dictText'
           },

		   {
            title: '状态',
            align:"center",
            dataIndex: 'fdStatus_dictText'
           },
    /*      {
            title: '操作',
            dataIndex: 'action',
            align:"center",
            scopedSlots: { customRender: 'action' },

          }*/
        ],
        confirmLoading: false,
        selectedRows: [],
		url: {
          list: "/rule/opersscTpReview/showOpersscFiddetail",
          delete: "/rule/opersscFiddetail/delete",
          deleteBatch: "/rule/opersscFiddetail/deleteBatch",
          exportXlsUrl: "rule/opersscFiddetail/exportXls",
          importExcelUrl: "rule/opersscFiddetail/importExcel",
       },
    }
  },

    methods: {
      edit(fdTableId,fdSscid) {
        this.visible = true;
        this.activeKey = '1'
        console.log(this.url);
        // this.model = Object.assign({}, record)
        // 加载子表数据
        this.fdTableId = { fdTableId: fdTableId }
        this.fdSscid = {fdSscid :fdSscid}
        this.loadData(fdTableId)

      },
      //查询某个tab的数据
      loadData( ) {
        this.loading = true
        var param = this.getQueryParams();
        var params = {pageNo:param.pageNo,pageSize:param.pageSize,fdTableId:this.fdTableId.fdTableId,fdSscid:this.fdSscid.fdSscid};
        getAction(this.url.list, params).then(res => {
          console.log(params)
          this.dataSource = res.result.records || [];
          this.ipagination.total = res.result.total;
        }).finally(() => {
          this. loading = false
        })
      },
      handleCancel() {
        this.close()
      },
      close() {
        this.visible = false
        this.$emit('close')
      },
      handleEdit: function (record) {
        this.$refs.opersscFiddetailModal_edit.edit(record);
        this.$refs.opersscFiddetailModal_edit.title = "编辑";
      },
    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less'
</style>